<?php
    if ($_POST['email'] and $_POST['pass']) {
        mysql_connect("Localhost", "root", "beep") or die(mysql_error());
        mysql_select_db("test") or die(mysql_error());
        $result = mysql_query("SELECT password FROM users WHERE login = '".$_POST['email']."' LIMIT 1");
        $row = mysql_fetch_array($result);
        if (sha1($_POST['pass']) == $row['password']) {
            echo 'ok';
        } else {
            echo 'nok';
        }
        mysql_close();
    }
?>